<template>
  <div class="good-li">
    <div class="image-detail">
      <div class="image-content">
        <template v-if="props.item.product">
          <image :src="props.item.product?.image" alt="" mode="aspectFit"></image>
        </template>
        <template v-else>
          <image src="https://cdn.uviewui.com/uview/goods/2.jpg" alt="" mode="aspectFit"></image>
        </template>
        <div class="like" v-if="index">{{ index }}</div>
      </div>
      <div class="name-sale">
        <template v-if="props.item.product">
          <div class="name">{{ props.item.product?.storeName }}</div>
        </template>
        <template v-else>
          <div class="name">{{ props.item.title }}</div>
        </template>
        <div class="sale">{{ props.item.addTime }}</div>
      </div>
    </div>
    <div class="price">
      <div class="money">
        -
        <template v-if="!props.item.title.indexOf('点数') > 1"> ￥ </template>
        {{ props.item.number }}
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
const props = defineProps<{
  item: any;
  index: number;
}>();
</script>

<style scoped lang="scss">
.good-li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 144rpx;
  padding: 0 16rpx;
  border-bottom: 1rpx solid #e4e4e4;
  .image-detail {
    display: flex;
    .image-content {
      position: relative;
      image {
        width: 72rpx;
        height: 72rpx;
        background: #ffffff;
      }
      .like {
        position: absolute;
        top: 0;
        left: 0;
        width: 24rpx;
        height: 24rpx;
        background: #f25a27;
        font-weight: 400;
        font-size: 16rpx;
        color: #ffffff;
        line-height: 24rpx;
        text-align: center;
        border-radius: 50%;
      }
    }
    .name-sale {
      margin: 0 16rpx;
      .name {
        font-weight: bold;
        font-size: 28rpx;
        color: #222222;
      }
      .sale {
        font-weight: 400;
        font-size: 24rpx;
        color: #6f6f6f;
        line-height: 32rpx;
        margin: 12rpx 0 0;
      }
    }
  }
}
</style>
